FROM maven:3-jdk-8-alpine as MVN_BUILD

WORKDIR /opt/sym/
ADD . /tmp
RUN cd /tmp  \
    && mvn package -DskipTests -Pci -q \
    && mv target/symphony/* /opt/sym/ \
    && cp -f /tmp/src/main/resources/docker/* /opt/sym/

FROM openjdk:8-alpine
LABEL maintainer="Liang Ding<845765@qq.com>"

WORKDIR /opt/sym/
COPY --from=MVN_BUILD /opt/sym/ /opt/sym/
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
    && apk add --no-cache ca-certificates tzdata ttf-dejavu \
    && rm -rf /tmp/* /var/cache/apk/*

ENV TZ=Asia/Shanghai
EXPOSE 9700

CMD java $JAVA_OPTS -cp lib/*:. org.b3log.symphony.Server $CONSOLE_ARGS